package com.hbzjt2012.operator;

public class Demo01 {
    public static void main(String[] args) {
        //二元运算符
        //Ctrl+D: 复制当前行到下一行
        int a = 10;
        int b = 20;
        int c = 25;
        int d = 25;

        System.out.println(a + b);
        System.out.println(a - b);
        System.out.println(a * b);
        System.out.println(a / (double) b);

        long aa = 23232321121121L;
        int bb = 123;
        short cc = 10;
        byte dd = 8;

        System.out.println(aa + bb + cc + dd);  //Long
        System.out.println(bb + cc + dd);  // Int
        System.out.println(cc + dd);  // Int

        //关系运算符返回的结果： 正确，错误     布尔值
        // if
        int ia = 10;
        int ib = 20;
        int ic = 21;

        System.out.println(ic % ia);    //ic/ia = 21 / 10 = 2 ... 1

        System.out.println(ia > ib);    //false
        System.out.println(ia < ib);    //true
        System.out.println(ia == ib);   //false
        System.out.println(ia != ib);   //true

        //++ -- 自增，自减   一元运算符
        int i_a = 3;
        int i_b = i_a++;    //执行完这行代码后，先给i_b赋值，再自增
        //i_a = i_a + 1
        System.out.println(i_a);
        //i_a = i_a + 1
        int i_c = ++i_a;    //执行完这行代码前，先自增，再给i_c赋值

        System.out.println(i_a);    //5
        System.out.println(i_b);    //3
        System.out.println(i_c);    //5

        //幂运算   2^3 2*2*2 = 8 很多运算，使用工具类来操作！
        double pow = Math.pow(2, 3);
        System.out.println(pow);
    }
}
